$(document).ready(function(){
    init();
});

function init(){
    var path = location.href;
    var id = path.substring(path.lastIndexOf("/")+1)

    $.ajax({
        url: "/product/findById",
        type: 'GET',
        data: {
            'id': id
        },
        dataType: "JSON",
        async: false,
        success: function (res) {
            if(res.code == "200") {
                var data = res.data;
                $(".contenta").val(data.content);
                $(".name").val(data.name);
                $(".price").val(data.price);
            } else {
                alert(res.msg);
            }
        },
        error: function (e) {
            alert('发生错误')
        }
    })

}